import CryptoJS from 'crypto-js';

export const decryptoAES = (password) => {

    var key = CryptoJS.enc.Utf8.parse('hu8j9r3gk4ord42n');
    var initialVector = CryptoJS.enc.Utf8.parse('kkmhed7036nbtfc8');

    var decrypted = CryptoJS.AES.decrypt(password, key, {
        iv: initialVector,
        mode: CryptoJS.mode.CBC,
        padding: CryptoJS.pad.Pkcs7
    });

    return CryptoJS.enc.Utf8.stringify(decrypted);

}

export const encryptoPBKDF2 = (password) => {

    let derivedKey = CryptoJS.PBKDF2(password, 'iry962g6wd2w39fw', {
        iterations: 100,
        keySize: 32,
        hasher: CryptoJS.algo.SHA512
    });

    return derivedKey.toString();

}